Literate Programming in C The CWEB System of Structured Software Documentation Manual for CWEBx3.0
نویسنده
چکیده
This document describes CWEBx3.0, a particular implementation of CWEB, a system that supports the concept of " literate programming " for programs written in the language C (more particularly for this version, in ANSI/ISO C). As this manual aims to supply all information possibly relevant to a wide variety of users, it is necessarily rather extensive. However, CWEB is not a complicated system, and just a few simple commands suffice for practical programming purposes; these are discussed in the section 4 (the remainder serves mainly to allow fine-tuning of the presentation of the printed documents describing literate programs). As the somewhat contrived name of the system indicates, CWEBx is not the only version of CWEB; indeed it is based on an older version of CWEB by Silvio Levy, which is an adaptation to C of the WEB system (for Pascal) written by Donald E. Knuth, the founder of literate programming. That CWEB system has independently evolved into a system that is currently distributed, under joint responsibility of Levy and Knuth, as CWEB 3.4. Those with experience using Levy/Knuth CWEB will already be acquainted with most aspects of CWEBx, and may turn to section 9 for a summary of the differences between the two systems; however, CWEBx also provides a compatibility mode (selectable by specifying '+c' on the command line) in which it should be able to process C programs written using Levy/Knuth CWEB without any modification. The structure of this manual is as follows. In section 2 an exposition of the ideas underlying the concept of literate programming is given, and a description of how systems of the WEB family provide concrete tools to support this programming methodology. This section is directed particularly to those who are new to literate programming; it explains the purpose of CWEB and the logical connection between the various elements that literate programming adds with respect to traditional programming. As an illustration we then give a small example program using CWEB in section 3. The main commands of CWEB, which define the structure of the source text and tell the CWEB tools what to do with the various pieces of that text, are discussed in section 4. In section 5 we discuss how the behaviour of CWEB tools can be further affected by means of command line options and file name arguments supplied when the programs are invoked. In section 6 we discuss some facilities …
منابع مشابه
Analysis of Literate Programs from the Viewpoint of Reuse
Donald Knuth created the WEB system for literate programming when he wrote the second version of TEX, a book-quality formatting system. Levy later created CWEB, which is based on Knuth’s WEB using the C programming language and supporting development using the C and C++ programming languages. Krommes’ FWEB is based on CWEB and supports several programming languages. We analyze some parts of the...
متن کاملAdding Native Language Support to the CWEB package and the TEX program
By adding National Language Support (NLS, for short) to literate programs I propose making such changes in their text via change files, which make modified programs aware of and able to support multiple languages. This paper describes how the GNU libc and gettext libraries were used to add NLS to the CWEB package and presents a possible way of bringing NLS to the TEX program. have one CWEB that...
متن کاملPlDoc: Wiki style Literate Programming for Prolog
This document introduces PlDoc, a literate programming system for Prolog. Starting point for PlDoc was minimal distraction from the programming task and maximal immediate reward, attempting to seduce the programmer to use the system. Minimal distraction is achieved using structured comments that are as closely as possible related to common Prolog documentation practices. Immediate reward is pro...
متن کاملHygienic Literate Programming: Lessons from ChezWEB
Literate programming systems are a class of domain specific languages designed to encourage writing programs specifically to be read as essays or books by humans instead of by machines. Systems like CWEB, WEB, and ChezWEB allow the user to associate arbitrary code bodies with a concise but natural language description. That description may then be referred to in other sections of the program so...
متن کاملPIDoc: Wiki style Literate Programming for Prolog
This document introduces PlDoc, a literate programming system for Prolog. Starting point for PlDoc was minimal distraction from the programming task and maximal immediate reward, attempting to seduce the programmer to use the system. Minimal distraction is achieved using structured comments that are as closely as possible related to common Prolog documentation practices. Immediate reward is pro...
متن کامل